Receive GitHub webhooks on Jenkins without public IP

Step 1: Create GitHub repository

First things first, we need to get a repository! If you haven’t got GitHub account, get one. You will need it later to login to Webhook Relay too. Once you have logged into GitHub, look for a green “New Repository”button on the bottom right corner and click it.

Step 2: Jenkins Installation (if you already have it - ignore this step)

Jenkins can easily be installed on Ubuntu by importing and adding the GPG keys to the system. Enabling the Jenkins repository:

 wget -p -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -

Now, to configure the firewall for the Jenkins server using the UFW tool, we need to enable the firewall and open port 8080 for remote access from anywhere.

 sudo ufw allow 8080
 sudo ufw enable
 sudo ufw reload
 sudo ufw status

Step 3: Setting upJenkins with GitHub-Plugin

The easiest way to start receiving GitHub webhooks is by using this plugin https://plugins.jenkins.io/github

• Go to your Jenkins plugin manager

• Find and install ‘’GitHub plugin"

• GitHub API Plugin - GitHub Integration Plugin

Step 4: Configuring Webhook Relay

First, you will have to register and download the agent. if you don’t have an account yet (you can use GitHub OAuth option since you would already have an account with it).

https://my.webhookrelay.com/login

Or install with command below:

curl https://my.webhookrelay.com/webhookrelay/downloads/install-cli.sh | bash
sudo chmod +wx /usr/local/bin/relay

Reference: https://docs.webhookrelay.com/ins tallation-options/installation-options/install-cli

Step 5: Setting up Webhook Relay agent

To login with the CLI use token key/secret: https://my.webhookrelay.com/tokens

Copy the relay login and run on your machine:

$ relay login -k your-token-key -s your-token-secret

Now, you will then need to start forwarding webhooks to Jenkins:

$ relay forward --bucket github-jenkins http://localhost:8080/github-webhook/

Step 6: Configuring Jenkins Job

When you want Jenkins to do something - create a job. In this case we will be using Freestyle project.